package com.wzy.facetextview.Utils;

import java.util.concurrent.BlockingQueue;
import java.util.concurrent.Executor;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

/**
 * Created by wangzhenyu on 2016/5/28.
 */
public class ConstantsUtil {
    private static final String TAG = "wang.ConstantsUtil";
    public static final String COMPAT_FACE_KEY = "/comcom/";

    /**
     * 以下使用到特殊字符' '，不是输入法中的空格，不要随便删除，否则会导致代码异常
     */
    public static final char BLANK = ' ';
    public static final String SMILEY_LOCAL_ADDR = "<img src=\"static/image/smiley/k ey/c ode.gif\" class=\"vm\">";
    public static final String FACE_KEY = "k ey";
    public static final String FACE_CODE = "c ode";

    private static final int CORE_POOL_SIZE = 5;
    private static final int MAXIMUM_POOL_SIZE = 128;
    private static final int KEEP_ALIVE = 1;
    private static final BlockingQueue<Runnable> sPoolWorkQueue = new LinkedBlockingQueue<Runnable>(10);

    public static final Executor THREAD_POOL_EXECUTOR = new ThreadPoolExecutor(CORE_POOL_SIZE, MAXIMUM_POOL_SIZE,
            KEEP_ALIVE, TimeUnit.SECONDS, sPoolWorkQueue, new ThreadPoolExecutor.DiscardOldestPolicy());


    // sharePreference action prefix
    private static final String PRE_SP_KEY = "com.wzy.spkey.";
    /**
     * 默认表情包版本
     */
    public static final String PREF_FACE_PKGS_DEFAUL_VERSION = PRE_SP_KEY + "PREF_FACE_PKGS_DEFAUL_VERSION";

    //匹配字符串中的img标签
    public static final String REGEXP_IMG = "<\\s*img\\s+([^>]+)\\s*>"; //<img.*src=(.*?)[^>]*?> || <\\s*img\\s+([^>]+)\\s*>
    //匹配字符串中的URL
    public static final String REGEXP_URL = "(((http|https)://)|(www|bbs|shop))"
            + "(([a-zA-Z0-9\\._-]+\\.[a-zA-Z]{2,6})|([0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}))"
            + "(:[0-9]{1,4})*(/[a-zA-Z0-9\\&%_\\./-~-]*)?";
    //匹配字符串中的超链接
    public static final String REGEXP_LINK_BEGIN = "\\<a.*\">";
    public static final String REGEXP_LINK_END = "</a>";
    //匹配换行符
    public static final String REGEXP_NEWLINE = "<br\\s*/>";
    // 转义的&符号
    public static final String REGEXP_AND = "&amp;";
    //表情占位符
    public static final String FACE_HOLDER_BEGIN = "[vivoface";
    public static final String FACE_HOLDER_END = "]";

}
